#include<iostream>
using namespace std;
/*oid Half_Sort(int arr[], int n)
{
	for (int i = 2; i < n; i++) {
		arr[0] = arr[i];
		int left = 1;
		int right = i - 1;
		while (left <= right) {
			int mid = (left + right) >> 1;
			if (arr[0] >= arr[mid]) {
				left = mid + 1;
			}
			else {
				right = mid - 1;
			}
		}
		for (int j = i; j > right + 1; j--) {
			arr[j] = arr[j - 1];
		}
		arr[right + 1] = arr[0];	
	}
}*/
void test(int arr[], int n)
{
	for (int i = 2; i <= n; i++) {
		arr[0] = arr[i];
		int low = 1;
		int high = i - 1;
		while (low <= high) {
			int mid = (low + high) >> 1;
			if (arr[0] >= arr[mid]) {
				low = mid + 1;
			}
			else {
				high = mid - 1;
			}
		}
		for (int j = i; j > high + 1; --j) {
			arr[j] = arr[j - 1];
	    }
		arr[high + 1] = arr[0];
	}
}
int main()
{
	int n;
	cin >> n;
	int arr[1001];
	for (int i = 0; i < n; i++) {
		cin >> arr[i + 1];
	}
	test(arr, n);
	for (int i = 1; i < n + 1; i++) {
		cout << arr[i] << " ";
	}
	return 0;
}